<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\UserLog */

$this->title = $model->person->name."的申请";
$this->params['breadcrumbs'][] = ['label' => '申请记录', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-log-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?/*= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) */?><!--
        --><?/*= Html::a('Delete', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) */?>
        <?
            if($model->status==1)
                echo Html::a('下一步', ['assign', 'id' => $model->id], ['class' => 'btn btn-primary'])

        ?>
        <?
            if($model->status==1)
            echo Html::a('拒绝申请', ['refuse', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => '确定要拒绝申请吗?',
                'method' => 'post',
            ],
        ]) ?>
    </p>
    <?
        $type = $model->type;
        if($type==1){
            $type="公司管理员申请";
        }
        if($type==2){
            $type="园区管理员申请";
        }
        $personName="";
        $companyName="";
        $parkName="";
        if($person= $model->person)
            $personName = $person->name;
        if($company = $model->company)
            $companyName = $company->name;
        if($park = $model->park)
            $parkName = $model->park->name;
    ?>
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
           // 'id',
            [
                'attribute'=>'申请时间',
                'value' =>date("Y-m-d H:i:s",$model->date),
            ],
            [
                'attribute'=>'申请人',
                'value' =>$personName,
            ],
            [
                'attribute'=>'申请类型',
                'value' =>$type,
            ],
            [
                'attribute'=>'申请公司',
                'value' =>$companyName,
            ],
            [
                'attribute'=>'申请园区',
                'value' =>$parkName,
            ],

            'idcard',
            [
                'attribute'=>'身份证图片',
                'format' => ['image',['width'=>'450','height'=>'350',]],
                'value' =>  $model->idcard_img,

            ],
            [
                'attribute'=>'公章图片',
                'format' => ['image',['width'=>'300','height'=>'300',]],
                'value' =>  $model->cachet_img,

            ],



        ],
    ]) ?>

</div>
